package org.movsim.simulator;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

public class Configuration {

    public static boolean LOG_TEMPORAL_PSYCHOLOGICAL_STATE;
    public static boolean LOG_TEMPORAL_DECISION_MAKING;

    final private static String CONF_PATH = "Configuration.xlsx";
    final public static String PSY_STATE_TRACE_OUT_PATH = "ptraces/pstates/";
    final public static String DECISION_TRACE_OUT_PATH = "ptraces/decision/";
    
    static {
        readConfig();
    }

    public static void readConfig() {
        try {
            FileInputStream fis = new FileInputStream(new File(CONF_PATH));
            Workbook book = WorkbookFactory.create(fis);
            Sheet sheet = book.getSheetAt(0);
            LOG_TEMPORAL_PSYCHOLOGICAL_STATE = sheet.getRow(0).getCell(1).getNumericCellValue() != 0;
            LOG_TEMPORAL_DECISION_MAKING = sheet.getRow(1).getCell(1).getNumericCellValue() != 0;
        } catch (InvalidFormatException | IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
